package com.example.forum.exception;

import com.example.forum.common.AppResult;

public class ApplicationException extends RuntimeException{     //创建一个异常类，加入状态码和状态描述

    //自定义错误
    protected AppResult errorResult;

    public AppResult getErrorResult() {
        return errorResult;
    }

    //指定状态码，异常描述
    public ApplicationException(AppResult errorResult){
        super(errorResult.getMessage());
        this.errorResult=errorResult;
    }

    //自定义异常描述
    public ApplicationException(String message){
        super(message);
    }

    public ApplicationException(String message, Throwable cause) {
        super(message, cause);
    }

    public ApplicationException(Throwable cause) {
        super(cause);
    }


}
